package controller;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ServletActionContext;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Map;

public class BaseAction extends ActionSupport {
    public Map<String ,Object> getMapRequest(){
      Map<String ,Object> map = (Map<String, Object>) ActionContext.getContext().get("request");
      return map;
    }
    public Map<String ,Object> getMapSession(){
       Map<String ,Object> map =  ActionContext.getContext().getSession();
       return map;
    }
    public HttpServletResponse getResponse(){
     HttpServletResponse response=  ServletActionContext.getResponse();
        response.setContentType("text/html; charset=UTF-8");
        return response;
    }
    public HttpSession getSession(){
        return  ServletActionContext.getRequest().getSession();
    }
}
